import orderApi from "@/api/declaration/mall/orderApi"
import httpRequest from "@/config/axios/httpRequest"
import { DeliveryModel } from "@/models/mall/OrderModel"


// 查询交易订单列表
export const getOrderPage = async (params: any) => {
  return await httpRequest.get(orderApi.GetOrderPage, params)
}

// 查询交易订单统计
export const getOrderSummary = async (params: any) => {
  return await httpRequest.get(orderApi.GetOrderSummary, params)
}

// 查询交易订单详情
export const getOrder = async (id: number | null) => {
  return await httpRequest.get(orderApi.GetOrder, { params: { id} })
}

// 查询交易订单物流详情
export const getExpressTrackList = async (id: number | null) => {
  return await httpRequest.get(orderApi.GetExpressTrackList, { params: { id} })
}


// 订单发货
export const deliveryOrder = async (data: DeliveryModel) => {
  return await httpRequest.put(orderApi.DeliveryOrder, data)
}

// 订单备注
export const updateOrderRemark = async (data: any) => {
  return await httpRequest.put(orderApi.UpdateOrderRemark, data)
}

// 订单调价
export const updateOrderPrice = async (data: any) => {
  return await httpRequest.put(orderApi.UpdateOrderPrice, data)
}

// 修改订单地址
export const updateOrderAddress = async (data: any) => {
  return await httpRequest.put(orderApi.UpdateOrderAddress, data)
}

// 订单核销
export const pickUpOrder = async (id: number) => {
  return await httpRequest.put(orderApi.PickUpOrder, { id })
}

// 订单核销
export const pickUpOrderByVerifyCode = async (pickUpVerifyCode: string) => {
  return await httpRequest.put(orderApi.PickUpOrderByVerifyCode, { pickUpVerifyCode })
}

// 查询核销码对应的订单
export const getOrderByPickUpVerifyCode = async (pickUpVerifyCode: string) => {
  return await httpRequest.get(orderApi.GetOrderByPickUpVerifyCode, { params: { pickUpVerifyCode } })
}
